package com.cros.pruebas2;

public class Animal2 { }
class Horse2 extends Animal2 { }
class UseAnimals {
	public void doStuff(Animal2 a) {
		System.out.println("In the Animal version");
	}
	public void doStuff(Horse2 h) {
		System.out.println("In the Horse version");
	}
	
	public static void main (String [] args) {
		UseAnimals ua = new UseAnimals();
		Animal2 animalObj = new Animal2();
		Horse2 horseObj = new Horse2();
		ua.doStuff(animalObj);
		ua.doStuff(horseObj);
		
		Animal2 animalRefToHorse = new Horse2();
		ua.doStuff(animalRefToHorse);//this call to Anima version
	}
}
